package com.topisv.tms.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.Role;

public interface RoleDao extends PagingAndSortingRepository<Role, Long>,JpaSpecificationExecutor<Role>{
	
	@Modifying
	@Query("select role from Role role,Userrole ur where role.id = ur.role.id and ur.user.id = ?1")
	List<Role> findByUserId(Long userid);
	
	Role  findByRolename(String rolename);
	
}
